package com.yidu.ruifeng_logistics.service.impl;

import com.yidu.ruifeng_logistics.entity.LogisticsAftermarket;
import com.yidu.ruifeng_logistics.dao.LogisticsAftermarketDao;
import com.yidu.ruifeng_logistics.service.LogisticsAftermarketService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 售后表(LogisticsAftermarket)表服务实现类
 *
 * @author makejava
 * @since 2021-03-09 14:24:34
 */
@Service("logisticsAftermarketService")
public class LogisticsAftermarketServiceImpl implements LogisticsAftermarketService {
    @Resource
    private LogisticsAftermarketDao logisticsAftermarketDao;

    /**
     * 通过ID查询单条数据
     *
     * @param aftermarketId 主键
     * @return 实例对象
     */
    @Override
    public LogisticsAftermarket queryById(Integer aftermarketId) {
        return this.logisticsAftermarketDao.queryById(aftermarketId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<LogisticsAftermarket> queryAllByLimit(int offset, int limit) {
        return this.logisticsAftermarketDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param logisticsAftermarket 实例对象
     * @return 实例对象
     */
    @Override
    public LogisticsAftermarket insert(LogisticsAftermarket logisticsAftermarket) {
        this.logisticsAftermarketDao.insert(logisticsAftermarket);
        return logisticsAftermarket;
    }

    /**
     * 修改数据
     *
     * @param logisticsAftermarket 实例对象
     * @return 实例对象
     */
    @Override
    public LogisticsAftermarket update(LogisticsAftermarket logisticsAftermarket) {
        this.logisticsAftermarketDao.update(logisticsAftermarket);
        return this.queryById(logisticsAftermarket.getAftermarketId());
    }

    /**
     * 通过主键删除数据
     *
     * @param aftermarketId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer aftermarketId) {
        return this.logisticsAftermarketDao.deleteById(aftermarketId) > 0;
    }

    @Override
    public List<LogisticsAftermarket> queryAll(LogisticsAftermarket logisticsAftermarket) {
        return this.logisticsAftermarketDao.queryAll(logisticsAftermarket);
    }

    @Override
    public List<LogisticsAftermarket> queryAll2(LogisticsAftermarket logisticsAftermarket) {
        return this.logisticsAftermarketDao.queryAll2(logisticsAftermarket);
    }

}
